<div class="col-xs-12 col-md-12 col-lg-12 status-bar">
    <div class="col-md-6" style="margin: 10px 0;">

        <select name="category_id" class="form-control radius-none">
            <option value="0">无分类</option>
            <?php echo $category_tree;?>
        </select>
    </div>
    <div class="col-md-12" id="goods_lists">

        <table class="table table-hover">
            <tr>
                <th>选择</th>
                <th>缩略图</th>
                <th>商品ID</th>
                <th>商品标题</th>
                <th>商品价格</th>
            </tr>
            <?php foreach($goods_info as $k => $v):?>
            <tr>
                <td style="line-height: 50px">
                    <input type="radio" data-price="<?php echo $v['goods_price']?>" name="goods_id" value="<?php echo $v['goods_id']?>">
                </td>
                <td>
                    <img src="<?php echo cutUrl($v['thumb'],50,50)?>" width="50px" height="50px">
                </td>
                <td style="line-height: 50px"><?php echo $v['goods_id']?></td>
                <td style="line-height: 50px"><?php echo $v['title']?></td>
                <td style="line-height: 50px"><?php echo sprintf("%.2f", ($v['goods_price'] / 100))?></td>
            </tr>
            <?php endforeach;?>
        </table>

    </div>
</div>
<script>

    $(function(){

        var page = 1;

        $('.layui-layer-content').unbind('scroll');
        $('.layui-layer-content').on('scroll',function(){

            var sh = 50 + $(this).scrollTop();

            var height = $(this)[0].scrollHeight - $(this).height();

            if (sh > height) {

                page = page +1;

                var category_id = $("select[name='category_id']").val();
                $.post(getActivityUrl,{'category_id':category_id,'page':page,'mothed':'ajax','action':'goods'},function(result){

                    $('#goods_lists')
                            .children()
                            .children('tbody')
                            .append(result);

                });



            }
        });
        $("select[name='category_id']").unbind('change')
        $("select[name='category_id']").change(function(){

            var category_id = $(this).val();

            page = 1;

            var load;
            var auto = setTimeout(function(){

                load = layer.load();

            },500)

            $.post(getActivityUrl,{'category_id':category_id,'page':page,'mothed':'ajax','action':'goods'},function(result){

                clearTimeout(auto);

                layer.close(load);

                $('#goods_lists')
                        .children()
                        .children('tbody')
                        .html(result);

            });

        })

    })

</script>